<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>退赔记录</title>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/default/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/icon.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/demo.css"/>
    	
	<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.min.js"></script>
	<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.easyui.min.js"></script>
	<script src="${pageContext.request.contextPath}/plugins/jQuery/easyui-lang-zh_CN.js"></script>
	<script src="${pageContext.request.contextPath }/admin/js/easyui_mergecell.js"></script>
	<script type="text/javascript">
	
	   $(function(){ 
	        $('#goodsid').combobox({
				valueField:'goods_id', //值字段
				textField:'app_name', //显示的字段
				url:'${pageContext.request.contextPath }/admin/return/findAllGoods',
				onLoadSuccess : function(data) {
		            $('#goodsid').combobox("setValue",-1);
	        	}
	        });
	        
	        $('#questionkind').combobox({
				valueField:'dict_code', //值字段
				textField:'dict_name', //显示的字段
				url:'${pageContext.request.contextPath }/admin/return/findAllQuestion',
				onLoadSuccess : function(data) {
		            $('#questionkind').combobox("setValue","-1");
	        	}
	        });

			loadTable();
			
	    });
		
		function loadTable(){
			var sortFlag = false;
			$('#dg').datagrid({
				rownumbers:true,
				singleSelect:true,
		 		url:'${pageContext.request.contextPath }/admin/return/listskureturn',
		 		queryParams:{
		 			 startDate:$("#start_time").textbox('getValue'),
		 			 endDate:$("#end_time").textbox('getValue'),
		 			 goodsid:$("#goodsid").combobox('getValue'),
		 			 questionkind:$("#questionkind").combobox('getValue')
		 		},
				rowStyler: function(index,row){
					if (row.ordernums=="合计"){
		//				return 'background-color:#6293BB;color:#fff;font-weight:bold;';
						return 'font-weight:bold;';
					}
				},
	    		columns:[[
	    		    {field:'goods_name',title:'SKU',align:'center',width:250,rowspan:2,formatter: function (value, row, index) {				
						return row.goods_name+"<br/>"+row.date;
					}},
	    		    {field:'ordernums',title:'总销售件数',align:'center',rowspan:2,width:110},
	    		    {field:'orderamounts',title:'总销售金额',align:'center',rowspan:2,width:80},    		    
	    		    {field:'question_kinds',title:'问题类型',align:'center',rowspan:2,width:100},
	    		    {title:'残次退赔',colspan:3},
	    		    {title:'整件退赔',colspan:3} 		    					
	 			],[
	 				{field:'ccnums',title:'退赔件数',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return row.ccnums=="0件"?"":row.ccnums;
					}},
	    		    {field:'ccamounts',title:'退赔金额',align:'center',rowspan:1,width:100,formatter: function (value, row, index) {				
						return row.ccamounts=="￥0"?"":row.ccamounts;
					}},
	    		    {field:'ccrate',title:'退赔率',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return row.ccrate=="0.0%" || row.ccrate=="0%"?"":row.ccrate;
					}},
	    		    {field:'zjnums',title:'退赔件数',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return row.zjnums=="0件"?"":row.zjnums;
					}},
	    		    {field:'zjamounts',title:'退赔金额',align:'center',rowspan:1,width:100,formatter: function (value, row, index) {				
						return row.zjamounts=="￥0"?"":row.zjamounts;
					}},
	    		    {field:'zjrate',title:'退赔率',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return (row.zjrate=="0.0%" || row.zjrate=="0%")?"":row.zjrate;
					}},
	 			]],
				onLoadSuccess:function(data){  
			     	if(!sortFlag) $(this).datagrid("autoMergeCells",['goods_name']);
				}
			});
		}
		
		function findData(){
			loadTable();
		}
		
		function refresh(){
			loadTable();
		}
		
		function toExcel(){
			$('#ff').submit();
//			Export('导出excel', $('#dg'));
		}
		
	</script>
	<style type="text/css">
		body{
		font-family:'微软雅黑';}
	</style>
  </head>
  
  <body>
	<table id="dg" toolbar="#searchtool" loadMsg="正在查询..." style="width:1150px;height:auto;"></table>
	<div id="searchtool" style="padding:5px; height:auto;">
		<form action="${pageContext.request.contextPath}/admin/return/exportReturnListBySku" method="post" id="ff">  
	       	<span style="margin:0px 12px;">开始时间:</span><input id="start_time" class="easyui-datebox" name="startDate" style="width:120px" value="${currDate }">  
	       	<span style="margin:0px 12px;">结束时间：</span><input id="end_time" class="easyui-datebox" name="endDate" style="width:120px" value="${currDate }">
	       	<span style="margin:0px 12px;">SKU:</span><input id="goodsid" class="easyui-textbox" name="goodsid" style="width:130px;height:26px"/>
	       	<span style="margin:0px 12px;">问题类型:</span><input id="questionkind" class="easyui-textbox" name="questionkind" style="width:130px;height:26px"/>  
	       	<a href="javascript:findData()" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:100px;margin:0px 3px;">查询</a>
	       	<a href="javascript:refresh()" class="easyui-linkbutton" data-options="iconCls:'icon-my-refresh'" style="width:100px;margin:0px 3px;">刷新</a>
	       	<a href="javascript:toExcel()" class="easyui-linkbutton" data-options="iconCls:'icon-my-save'" style="width:100px;margin:0px 3px;">导出Excel</a>
    	</form>
    </div>
  </body>
</html>
